#include "./vPass.h"

namespace Vendetta {
	vPass::vPass() {
		mLightingOn = true;
		mAmbient = vColor(0.5, 0.5, 0.5);
		mDiffuse = vColor(0.6, 0.6, 0.6);
		mSpecular = vColor::Black;
		mEmissive = vColor::Black;
		mSpecularFactor = -1;
		mTextureUnits<<(new vTextureUnit());
	}

	vPass::vPass(const vPass& pass) {
	}

	vPass::~vPass() {
		vUInt uiPos = 0;
		vTextureUnit* pUnit;
		while (mTextureUnits.Size() > 0) {
			pUnit = mTextureUnits[0];
			if (pUnit) {
				delete pUnit;
			}
			mTextureUnits.RemoveFirst();
		}
	}
	
	vPass& vPass::operator=(const vPass& pass) {
		return *this;
	}

	vVoid vPass::SetLighting(vBool bEnabled) {
		mLightingOn = bEnabled;
	}

	vVoid vPass::SetAmbient(const vColor& color) {
		mAmbient = color;
	}

	vVoid vPass::SetDiffuse(const vColor& color) {
		mDiffuse = color;
	}

	vVoid vPass::SetSpecular(const vColor& color, vReal rFactor) {
		mSpecular = color;
		mSpecularFactor = rFactor;
	}

	vVoid vPass::SetEmissive(const vColor& color) {
		mEmissive = color;
	}

	vVoid vPass::addTextureUnit(vTextureUnit* unit) {
		mTextureUnits<<unit;
	}

	vTextureUnit* vPass::createTextureUnit(vBool bBlendingOn, vTextureUnit::eBlendMode srcBlendMode, 
			vTextureUnit::eBlendMode dstBlendMode, vTextureUnit::eAddressMode uAddressMode, 
			vTextureUnit::eAddressMode vAddressMode, vTextureUnit::eAddressMode wAddressMode, 
			vTextureUnit::eFilterMode minMagFilterMode, vReal rRotateAngle, vReal rXScale, 
			vReal rYScale, vTexture* pTexture) {
		vTextureUnit* pTextUnit = new vTextureUnit;
		pTextUnit->SetBlending(bBlendingOn);
		pTextUnit->SetSrcBlendMode(srcBlendMode);
		pTextUnit->SetDstBlendMode(dstBlendMode);
		pTextUnit->SetUAddressMode(uAddressMode);
		pTextUnit->SetVAddressMode(vAddressMode);
		pTextUnit->SetWAddressMode(wAddressMode);
		pTextUnit->SetMinMagFilterMode(minMagFilterMode);
		pTextUnit->SetRotate(rRotateAngle);
		pTextUnit->SetXScale(rXScale);
		pTextUnit->SetYScale(rYScale);
		pTextUnit->AttachTexture(pTexture);

		return pTextUnit;
	}

	vTextureUnit* vPass::createTextureUnit(vBool bBlendingOn, vTextureUnit::eBlendMode srcBlendMode, 
		vTextureUnit::eBlendMode dstBlendMode, vTextureUnit::eAddressMode uAddressMode, 
		vTextureUnit::eAddressMode vAddressMode, vTextureUnit::eAddressMode wAddressMode, 
		vTextureUnit::eFilterMode minMagFilterMode, vReal rRotateAngle, vReal rXYScale, 
		vTexture* pTexture) {
		vTextureUnit* pTextUnit = new vTextureUnit;
		pTextUnit->SetBlending(bBlendingOn);
		pTextUnit->SetSrcBlendMode(srcBlendMode);
		pTextUnit->SetDstBlendMode(dstBlendMode);
		pTextUnit->SetUAddressMode(uAddressMode);
		pTextUnit->SetVAddressMode(vAddressMode);
		pTextUnit->SetWAddressMode(wAddressMode);
		pTextUnit->SetMinMagFilterMode(minMagFilterMode);
		pTextUnit->SetRotate(rRotateAngle);
		pTextUnit->SetXYScale(rXYScale);
		pTextUnit->AttachTexture(pTexture);

		return pTextUnit;
	}

	vTextureUnit* vPass::createTextureUnit(vBool bBlendingOn, vTextureUnit::eBlendMode srcBlendMode, 
		vTextureUnit::eBlendMode dstBlendMode, vTextureUnit::eAddressMode uAddressMode, 
		vTextureUnit::eAddressMode vAddressMode, vTextureUnit::eAddressMode wAddressMode, 
		vTextureUnit::eFilterMode minMagFilterMode, vReal rRotateAngle, vTexture* pTexture) {
		vTextureUnit* pTextUnit = new vTextureUnit;
		pTextUnit->SetBlending(bBlendingOn);
		pTextUnit->SetSrcBlendMode(srcBlendMode);
		pTextUnit->SetDstBlendMode(dstBlendMode);
		pTextUnit->SetUAddressMode(uAddressMode);
		pTextUnit->SetVAddressMode(vAddressMode);
		pTextUnit->SetWAddressMode(wAddressMode);
		pTextUnit->SetMinMagFilterMode(minMagFilterMode);
		pTextUnit->SetRotate(rRotateAngle);
		pTextUnit->AttachTexture(pTexture);

		return pTextUnit;
	}

	vTextureUnit* vPass::createTextureUnit(vBool bBlendingOn, vTextureUnit::eBlendMode srcBlendMode, 
			vTextureUnit::eBlendMode dstBlendMode, vTextureUnit::eAddressMode uAddressMode, 
			vTextureUnit::eAddressMode vAddressMode, vTextureUnit::eAddressMode wAddressMode, 
			vTextureUnit::eFilterMode minMagFilterMode, vTexture* pTexture) {
		vTextureUnit* pTextUnit = new vTextureUnit;
		pTextUnit->SetBlending(bBlendingOn);
		pTextUnit->SetSrcBlendMode(srcBlendMode);
		pTextUnit->SetDstBlendMode(dstBlendMode);
		pTextUnit->SetUAddressMode(uAddressMode);
		pTextUnit->SetVAddressMode(vAddressMode);
		pTextUnit->SetWAddressMode(wAddressMode);
		pTextUnit->SetMinMagFilterMode(minMagFilterMode);
		pTextUnit->AttachTexture(pTexture);

		return pTextUnit;
	}

	vTextureUnit* vPass::createTextureUnit(vBool bBlendingOn, vTextureUnit::eBlendMode srcBlendMode, 
		vTextureUnit::eBlendMode dstBlendMode, vTextureUnit::eAddressMode uAddressMode, 
		vTextureUnit::eAddressMode vAddressMode, vTextureUnit::eAddressMode wAddressMode, 
		vTexture* pTexture) {
		vTextureUnit* pTextUnit = new vTextureUnit;
		pTextUnit->SetBlending(bBlendingOn);
		pTextUnit->SetSrcBlendMode(srcBlendMode);
		pTextUnit->SetDstBlendMode(dstBlendMode);
		pTextUnit->SetUAddressMode(uAddressMode);
		pTextUnit->SetVAddressMode(vAddressMode);
		pTextUnit->SetWAddressMode(wAddressMode);
		pTextUnit->AttachTexture(pTexture);

		return pTextUnit;
	}

	vTextureUnit* vPass::createTextureUnit(vBool bBlendingOn, vTextureUnit::eBlendMode srcBlendMode, 
		vTextureUnit::eBlendMode dstBlendMode, vTextureUnit::eAddressMode uvwAddressMode, 
		vTexture* pTexture) {
		vTextureUnit* pTextUnit = new vTextureUnit;
		pTextUnit->SetBlending(bBlendingOn);
		pTextUnit->SetSrcBlendMode(srcBlendMode);
		pTextUnit->SetDstBlendMode(dstBlendMode);
		pTextUnit->SetUVWAddressMode(uvwAddressMode);
		pTextUnit->AttachTexture(pTexture);

		return pTextUnit;
	}

	vTextureUnit* vPass::createTextureUnit(vTextureUnit::eAddressMode uAddressMode, 
		vTextureUnit::eAddressMode vAddressMode, vTextureUnit::eAddressMode wAddressMode, 
		vTexture* pTexture) {
		vTextureUnit* pTextUnit = new vTextureUnit;
		pTextUnit->SetUAddressMode(uAddressMode);
		pTextUnit->SetVAddressMode(vAddressMode);
		pTextUnit->SetWAddressMode(wAddressMode);
		pTextUnit->AttachTexture(pTexture);

		return pTextUnit;
	}

	vTextureUnit* vPass::createTextureUnit(vBool bBlendingOn, vTextureUnit::eBlendMode srcBlendMode, 
		vTextureUnit::eBlendMode dstBlendMode, vTexture* pTexture) {
		vTextureUnit* pTextUnit = new vTextureUnit;
		pTextUnit->SetBlending(bBlendingOn);
		pTextUnit->SetSrcBlendMode(srcBlendMode);
		pTextUnit->SetDstBlendMode(dstBlendMode);
		pTextUnit->AttachTexture(pTexture);

		return pTextUnit;
	}

	vTextureUnit* vPass::createTextureUnit(vTextureUnit::eAddressMode uvwAddressMode, vTexture* pTexture) {
		vTextureUnit* pTextUnit = new vTextureUnit;
		pTextUnit->SetUVWAddressMode(uvwAddressMode);
		pTextUnit->AttachTexture(pTexture);

		return pTextUnit;
	}

	vTextureUnit* vPass::createTextureUnit(vTextureUnit::eFilterMode minMagFilterMode, vTexture* pTexture) {
		vTextureUnit* pTextUnit = new vTextureUnit;
		pTextUnit->SetMinMagFilterMode(minMagFilterMode);
		pTextUnit->AttachTexture(pTexture);

		return pTextUnit;
	}

	vTextureUnit* vPass::createTextureUnit(vTexture* pTexture, vReal rRotateAngle, vReal rXScale, 
		vReal rYScale) {
		vTextureUnit* pTextUnit = new vTextureUnit;
		pTextUnit->SetRotate(rRotateAngle);
		pTextUnit->SetXScale(rXScale);
		pTextUnit->SetYScale(rYScale);
		pTextUnit->AttachTexture(pTexture);

		return pTextUnit;
	}
}